package base;

import java.util.Deque;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;

/**
 * 打印如下格式
 * [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
 * [2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
 * [3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
 * ...
 * [91, 92, 93, 94, 95, 96, 97, 98, 99, 100]
 *
 * @author 王霄
 * @date 2022/2/20 16:22
 */
public class LinkedListDemo {

    private static final Deque<Integer> DEQUE = new LinkedList<>(List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10));

    public static void main(String[] args) throws InterruptedException {
        for (int i = 0; i <= 90; i++) {
            System.out.println(DEQUE);
            Integer first = Optional.ofNullable(DEQUE.pollFirst()).orElse(0);
            DEQUE.offerLast(first + 10);
        }
    }
}
